home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
lists
/
gem
/
l_1199
/
1158
< prev
next >
Wrap
Internet Message Format
|
1994-08-27
|
8KB
Date: Sat, 30 Jul 94 02:50 CDT
From: ekl@sdf.lonestar.org (Evan K. Langlois)
To: gem-list@world.std.com
Subject: Re: app_defs.sys
Precedence: bulk
Someone is gonna dump me from the list for adding too much to it, but ..
========================================================================
How about for terminal programs? This is one I've struggled with
myself. Most terminal programs CRAWL under MultiTOS for two reasons:
0-lenght timers slow everything down, and GEM doesn't get back to the
program fast enough when catching characters from the modem so typing
comes out unbearably jumpy.
========================================================================
I know a really good way, but it needs multiple threads of execution.
(You use tfork() in the MiNTLIB) and you also need Fselect (or some
similar method of blocking for modem IO).
Now, I'm bassing this code off the assumption that a thread can call
the AES to get a rectangle list and draw its own text since it shares
the parents memory and app_id.
Now, here is the structure. Thread 1 - this is the main code that
calls evnt_multi() and waits there. It doesn't use any timer events.
If it reads any keypresses, they are sent directly to the modem.
This thread blocks when you don't have any keyboard events or other
GEM events. Redraws can be done with shared memory.
Thread2 - this waits on any number of file handles, although it only
needs to wait on one (optional timeout). It blocks until the
device is has data ready to be read or written. When Fselect returns,
Fread as much data from the file handle (raw mode) as you can,
with standard GEMDOS Fread() with a whatever maximum you like (you
can use whatever you like, or dynamically change the size if Fread
reads your entire buffer, then double the size so it doesn't fill
up anymore!) After you read all the data, update your windows
internal and external structures. Key events are still echoed
directly to the modem, even during redraw. Once you've done the
update, call Fselect again and wait for more modem data. This thread
will block when there is no modem IO to read.
You can make things a bit more complex by making the display
"thread" separate from the modemIO/Fselect thread and just
use Pmsg() to pass events back and forth. This also allows
you to do a local echo by passing a message for keyboard
events, and you can fully encapsulate the "Window" as a
true active object that sits, waiting for events, and you
can do synchronizing between the threads too, like if you
don't want the IO thread to continue until you finish updating
your window (so you won't get lots of Pmsg's in a row) then
you can have that thread wait for a reply. I can elaborate
on this model more if you like.
In either of the two models above, all threads will block when
needed and can operate independantly of the other so you don't
have to wait for data being sent just to recieve data. For
lots of data, Pmsg() that passes a pointer to the data is probably
best, but you can always make the window "Object" open a pipe
and stuff vt52 data into it and let the window code worry about
the rest :-) The first is pretty easy to write if you already
have the window display code written. The second takes a bit
more tweaking, but its very expandable and flexible.
========================================================================
I figured that things would work a bit better (and cooperate with the
rest of the system) if I used a longer timer. Things speed up a bit, but
typing us just as jumpy (when your host is the one who is echoing).
Any suggestions?
========================================================================
Optimize your redraw code to death, use jump scrolling, use large
buffers. I'm not sure if you can set modem IO to raw mode without
MiNT. I think Fread will just use cr-mode and will wait until it
reads an end-of-line character. With MiNT, you set the file handle
to raw mode and you can get masive amounts of data at once (saves
all that time calling the bios at 1920 times per second!)
Have you achieved the speed of Connect? If Connect threaded I don't
think there would be a limit to its speed :-) Then again, maybe
it does use RAW mode .. I've never tried Connect without MiNT.
Timer events really suck because you are trying to control the
multitasking without sufficient information. Using blocking threads
seems to work quite well.
In fact, I'm using a double-threaded terminal now, but its unbuffered.
I still use BIOS (I'll change that). And I didn't feel like writing
code for windows, fonts, and scrollback, so I use BIOS output and
let TOSWIN do the work. However, the overhead of TOSWIN made my
first attempts, using Bconstat() a total failure! It wouldn't
keep up with 2400! Threading made things VERY fast. Just as fast
as Connect actually, or almost since JUMP scrolling can be VERY
jumpy if I click a mouse button and hold it (locking the window
update). I've done some tests piping data and such, but without
a faster modem I can't make a good comparison. But I rewrite for
Fselect/Fread instead of BIOS it will be MUCH faster.
========================================================================
I don't want app_defs.sys turning into another win.ini. When you install
a Windoze program, it adds all this CRAP to your system files like
win.ini, etc., and then when you want to remove the app, you still have
this crap in your win.ini file.
========================================================================
A de-installer just looks for AppName* and deletes those lines.
In fact, a single Install/De-Install proram that copied files, added
and removed icons from the desktop files, and deleted entries from
app-defs.sys would be quite handy, especially if it decompressed
files too before installing them! You wouldn't modify app-defs
on installation.
========================================================================
My library can now do dragging of active and passive sliders in
background windows, as well as buttons. It also handles all of these
things using the rectangles list so they come out properly if partially
obscured.
========================================================================
Hmm .. how? You don't get any events until you release the button!
What sort of hackery is this? Could you post the code? Or email
it to evanlang@uss.lonestar.org?
========================================================================
How is a menu structured? It seems kinda odd the way the objects are
arranged in it... boxes, iboxes, etc. What's a sure way to just go
through JUST the titles one at a time? How do I get the first title?
Require the programmer to pass the object number of the desk title? That
would make it easiest.
========================================================================
If you want to disable menus for modal dialogs, the easiest way is to
have 2 menu bars. One normal, and the second with just the Desk Menu
enabled and the rest of the titles disabled. Then you can swap
menu bars .. all the user sees is the titles de-selecting. As for
just the titles, they are all children of the menu bar. Here :
ROOT (G_IBOX)
/ \
BAR (G_BOX) DROPDOWNS (G_IBOX)
| / | \
ACTIVE (G_IBOX) G_BOX G_BOX G_BOX
/ | \
G_TITLE G_TITLE G_TITLE
The object structure has all the child pointers and indexes and
stuff that you need. Once you find the ACTIVE G_IBOX, all
its children are your menu titles, in order too I think!
And yes, you could just pass the object number of the TITLE. That
is easier than any other method, except swapping menus, but using
the object index and the objc_ functions is a better solution.
========================================================================
You have an Atari book that needs to be published? Two Worlds Publishing
can do it for you. :)
========================================================================
The internet frowns on commercial advertising .. can you have a
shareware publishing company?